home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Original Code / Dialog Boxes / DrawOrFillEllipseWithApply / ColorFillDialogBoxWithApply.cs next >
Encoding:
Text File  |  2001-01-15  |  1.3 KB  |  40 lines

  1. //----------------------------------------------------------
  2. // ColorFillDialogBoxWithApply.cs ⌐ 2001 by Charles Petzold
  3. //----------------------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class ColorFillDialogBoxWithApply: ColorFillDialogBox
  9. {
  10.      Button btnApply;      
  11.  
  12.      public event EventHandler Apply;
  13.  
  14.      public ColorFillDialogBoxWithApply()
  15.      {
  16.           grpbox.Location = new Point(36, 8);
  17.           chkbox.Location = new Point(36, grpbox.Bottom + 4);
  18.  
  19.           btnApply = new Button();
  20.           btnApply.Parent   = this;
  21.           btnApply.Enabled  = false;
  22.           btnApply.Text     = "Apply";
  23.           btnApply.Location = new Point(120, chkbox.Bottom + 4);
  24.           btnApply.Size     = new Size(40, 16);
  25.           btnApply.Click   += new EventHandler(ButtonApplyOnClick);
  26.  
  27.           ClientSize = new Size(168, btnApply.Bottom + 8);
  28.           AutoScaleBaseSize = new Size(4, 8);
  29.      }
  30.      public bool ShowApply
  31.      {
  32.           get { return btnApply.Enabled; }
  33.           set { btnApply.Enabled = value; }
  34.      }
  35.      void ButtonApplyOnClick(object obj, EventArgs ea)
  36.      {
  37.           if (Apply != null)
  38.                Apply(this, new EventArgs());
  39.      }
  40. }